/****************************************************
          File Name:main.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 15 Nov 2014 07:06:23 PM CST
*****************************************************/

#include "capture_encode.h"

int main(int argc, char *argv[])
{
	if(argc < 3)
	{
		fprintf(stderr, "%s xx.h264 time(s) | %s out.h264 10 :\
		recode 10s h264 video\n", argv[0], argv[0]);
		exit(EXIT_FAILURE);
	}
	Encoder value;
	
	value_init(&value);
	
	
	value.h264_fd = open(argv[1],O_CREAT | O_RDWR | O_APPEND, 00644);
	
	value.count = atoi(argv[2]) * 30;
	
	dev_open();
	
	dev_init();
	start_capture();
	
	capture_process(&value);
	
	stop_capture();
	
	dev_uninit();
	
	x264_encoder_close(value.encoder);
	close(value.h264_fd);
	free(value.yuv420_frame);
	free(value.yuv422_frame);
	free(value.pic_in);
	free(value.param);

}
	

	
	